home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / contrib / hanna / gnulib_x11.h < prev    next >
C/C++ Source or Header  |  1992-04-16  |  3KB  |  88 lines

  1. #ifndef _GNULIB_X11_H
  2. #define _GNULIB_X11_H
  3.  
  4. /*-----------------------------------------------------------------------------
  5.  * gnulib_x11 - Functions to read 'xlib' format gnuplot files into drawables.
  6.  *
  7.  * by gregg hanna (gregor@kafka.saic.com)
  8.  * based on gnuplot_x11 by Ed Kubaitis (University of Illinois)
  9.  *---------------------------------------------------------------------------*/
  10.  
  11. #include <X11/Intrinsic.h>
  12. #include <stdio.h>
  13.  
  14. /*-----------------------------------------------------------------------------
  15.  *  PLOT FUNCTIONS - read data from a file/stream and draw into a drawable
  16.  *---------------------------------------------------------------------------*/
  17.  
  18. /*-----------------------------------------------------------------------------
  19.  *   GP_PlotFromStream - reads a gnuplot (xlib) from an open stream
  20.  *     fp:  a stream to read from, may be a pipe (as returned by popen(3))
  21.  *     colortable:  returned from GP_AllocColor or GP_ColorArray
  22.  *                  if NULL previous setting is used
  23.  *     ufont:  font used for text in this plot; if NULL, a default font is used
  24.  *---------------------------------------------------------------------------*/
  25.  
  26. #ifndef _NO_PROTO
  27. int GP_PlotFromStream(FILE *fp,Display *dpy,Drawable pixmap,Pixel *colortable,XFontStruct *ufont);
  28. #else
  29. int GP_PlotFromStream();
  30. #endif
  31.  
  32. /*-----------------------------------------------------------------------------
  33.  *   GP_PlotFromFile - reads a gnuplot from a file, drawing it in a pixmap
  34.  *     colortable:  returned from GP_AllocColor or GP_ColorArray
  35.  *                  if NULL previous setting is used
  36.  *     ufont:  font used for text in this plot; if NULL, a default font is used
  37.  *---------------------------------------------------------------------------*/
  38.  
  39. #ifndef _NO_PROTO
  40. int GP_PlotFromFile(char *fn,Display *dpy,Drawable pixmap,Pixel *colortable,XFontStruct *ufont);
  41. #else
  42. int GP_PlotFromFile();
  43. #endif
  44.  
  45. /*-----------------------------------------------------------------------------
  46.  *  COLOR FUNCTIONS - create color array and set default color
  47.  *---------------------------------------------------------------------------*/
  48.  
  49. /*-----------------------------------------------------------------------------
  50.  *   GP_ColorArray - build a color array with specified colors
  51.  *---------------------------------------------------------------------------*/
  52. #ifndef _NO_PROTO
  53. Pixel *GP_ColorArray( Pixel bg, Pixel fg,
  54.               Pixel c0, Pixel c1, Pixel c2, Pixel c3, Pixel c4,
  55.               Pixel c5, Pixel c6, Pixel c7, Pixel c8);
  56.  
  57. #else
  58.  
  59. Pixel *GP_ColorArray();
  60.  
  61. #endif
  62.  
  63. /*-----------------------------------------------------------------------------
  64.  *   GP_AllocColor - allocate colors and build color array
  65.  *     mode: color mode to allocate colors for, modes are:
  66.  *          GP_COLOR - allocate colors (uses default gnuplot_x11 colors)
  67.  *          GP_GRAY - allocate grayscale
  68.  *          GP_MONO - allocate monocolor
  69.  *          GP_REVERSE - allocate reversed monocolor
  70.  *          GP_DEFAULT - the software will select one of the above based on
  71.  *              the default visual (probably the best choice for general use)
  72.  *---------------------------------------------------------------------------*/
  73.  
  74. #define GP_COLOR   1
  75. #define GP_GRAY    2
  76. #define GP_MONO    3
  77. #define GP_REVERSE 4
  78. #define GP_DEFAULT 0
  79.  
  80. #ifndef _NO_PROTO
  81. Pixel *GP_AllocColor(Display *dpy, int mode);
  82. #else
  83. Pixel *GP_AllocColor();
  84. #endif
  85.  
  86.  
  87. #endif
  88.